﻿<div class="page-header">
    <h1>Index of post</h1>
</div>

<div class="row">
    <div class="span12">
        <p><%- link_to('<i class="icon-plus icon-white"></i> New post', path_to.new_post(), {class: 'btn btn-primary'}) %></>
		<p><%- widget("posts","test",{a:"1"}) %></>
    </div>
</div>

<div class="row">
    <div class="span12">
        <% if (posts.length > 0) { %>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <% posts.forEach(function (post) { %>
                        <tr>
                            <td><strong><%- link_to('post #' + post.id, path_to.post(post)) %></strong></td>
                            <td>
                                <%- link_to('<i class="icon-edit"></i> Edit', path_to.edit_post(post), {class: 'btn btn-mini'}) %>
                                <%- link_to('<i class="icon-remove icon-white"></i> Delete', path_to.post(post), {class: 'btn btn-mini btn-danger', method: 'delete', remote: true, jsonp: '(function (u) {location.href = u;})'}) %>        
                            </td>
                        </tr>
                    <% }); %>        
                </tbody>
            </table>
        <% } else { %>
            <p class="alert alert-block alert-info">
                <strong>No posts were found.</strong> 
            </p>
        <% } %>
    </div>
</div>